﻿<!--
  Extended Silverlight Toolkit - SAMPLE CODE

  Copyright (C) 2010-2012 Xceed Software Inc.

  This program is provided to you under the terms of the Microsoft Public
  License (Ms-PL) as published at http://extendedsilverlight.codeplex.com/license

  Please purchase a commercial version of this toolkit if you are using
  it in a commercial product. The commercial versions support the project,
  and also include more features for each control, priority support,
  source code, updates, removed watermark, and a proprietary license.

  Visit http://xceed.com and follow @datagrid on Twitter.
-->

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:sllb="http://schemas.xceed.com/silverlight/xaml/listbox"
                    xmlns:utils="clr-namespace:Xceed.Utils.Silverlight.ListBox.Samples">
   <SolidColorBrush x:Key="metroAccentBrush"
                    Color="#FFF09609" />

   <sllb:ImageConverter x:Key="imageConverter" />

   <utils:UnitsInStockToOpacityConverter x:Key="normallyVisibleOpacityConverter"
                                                DefaultOpacity="1"
                                                AlternateOpacity="0.3"/>

   <utils:UnitsInStockToOpacityConverter x:Key="notNormallyVisibleOpacityConverter"
                                                DefaultOpacity="0"
                                                AlternateOpacity="0.3"/>

   <DataTemplate x:Key="productListBoxItemTemplate">
      <Grid Opacity="{Binding Path=UnitsInStock, Converter={StaticResource normallyVisibleOpacityConverter}}">
         <Grid.ColumnDefinitions>
            <ColumnDefinition Width="65" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="50" />
         </Grid.ColumnDefinitions>
         <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
         </Grid.RowDefinitions>

         <Border Grid.RowSpan="3"
                 BorderBrush="#BEBEBE"
                 BorderThickness="1"
                 Margin="0,0,5,0">
            <Image Source="{Binding Path=Photo, Converter={StaticResource imageConverter}}"
                   Height="60"
                   Width="60"
                   Stretch="UniformToFill" />
         </Border>

         <TextBlock Grid.Column="1"
                    Grid.ColumnSpan="5"
                    Grid.Row="0"
                    FontSize="24"
                    Text="{Binding ProductName}"
                    TextTrimming="WordEllipsis" />

         <TextBlock Grid.Column="1"
                    Grid.Row="1"
                    Foreground="#FF808080"
                    Text="QUANTITY " />

         <TextBlock Grid.Column="2"
                    Grid.Row="1"
                    Foreground="{StaticResource metroAccentBrush}"
                    Text="{Binding UnitsInStock}" />

         <TextBlock Grid.Column="4"
                    Grid.Row="1"
                    Foreground="#FF808080"
                    Text="PRICE " />

         <TextBlock Grid.Column="5"
                    Grid.Row="1"
                    Foreground="{StaticResource metroAccentBrush}"
                    Text="{Binding UnitPrice, StringFormat=\{0:C\}}" />

         <Border Grid.ColumnSpan="6" 
                 Grid.RowSpan="3" 
                 Opacity="{Binding Path=UnitsInStock, Converter={StaticResource notNormallyVisibleOpacityConverter}}">
            <Border.Background>
               <LinearGradientBrush StartPoint="-0.015,0.1"
                                    EndPoint="9.187,9.236"
                                    SpreadMethod="Repeat"
                                    MappingMode="Absolute">
                  <GradientStop Offset="0"
                                Color="Transparent" />
                  <GradientStop Color="Transparent"
                                Offset="0.5" />
                  <GradientStop Offset="0.5"
                                Color="Black" />
                  <GradientStop Offset="1"
                                Color="Black" />
               </LinearGradientBrush>
            </Border.Background>
         </Border>
      </Grid>
   </DataTemplate>

</ResourceDictionary>
